package com.rqf.mr.controller;

import java.sql.SQLException;
import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import com.rqf.mr.service.ILoginService;
import com.rqf.mr.service.IRoundService;
import com.server.web.JSONSerielizer;
import com.server.web.OutputUtil;


/**
 * 登录相关
 * @author HelloWorld_luo
 * @date 2016年4月18日
 */
@Controller
@RequestMapping("round")
public class RoundController {
	
	@Autowired
	private IRoundService roundService;
	
	@RequestMapping("insertRecord/{inpatiId}/{nurseLoginId}")
	public void insertRecord(HttpServletRequest request, 
			HttpServletResponse response,@PathVariable String inpatiId,
			@PathVariable String nurseLoginId){
		Boolean isSuccess;
		isSuccess = roundService.insertRoundRecord(inpatiId, nurseLoginId);
		OutputUtil.returnJsonp(request, response, isSuccess.toString());
	}
	
	@RequestMapping("searchRecord/{inpatiId}/{nurseLoginId}")
	public void searchRecord(HttpServletRequest request, 
			HttpServletResponse response,@PathVariable String inpatiId,
			@PathVariable String nurseLoginId){
		List<Map<String, Object>> list = roundService.searchRoundRecord(inpatiId, nurseLoginId);
		String json = JSONSerielizer.toJson(list, null, null);
		OutputUtil.returnJsonp(request, response, json);
	}
}
